package cmarter.dev.chpt2.threading;

import java.util.Arrays;
import java.util.List;

import cmarter.dev.entities.Apple;

@SuppressWarnings("unused")
public class Java8Runnable {
	private static List<Apple> apples;

	public static void main(String[] args) {
		init();		
		
		traditionalThreadExample();		
		java8LambdaThreadingExample();
	}

	private static void java8LambdaThreadingExample() {
		Thread t = new Thread(() -> System.out.println("hello world"));
		
		t.run();
	}

	private static void traditionalThreadExample() {
		Thread t = new Thread(new Runnable() {			
			@Override
			public void run() {
				System.out.println("hello world");
			}
		});
		
		t.run();
	}
	
	private static void init() {
		apples = Arrays.asList(new Apple("green", 90d, "Granny Smith"),
				   new Apple("green", 150d, "Granny Smith"),
				   new Apple("green", 190d, "smith"),
				   new Apple("green", 149d, "smith"),
				   new Apple("green", 160d, "smith"),
				   new Apple("red", 190d, "Fuji"));
	}

}
